// Copyright 2020 Tier IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
// Author: v1.0 Yukihiro Saito
//

#ifndef MULTI_OBJECT_TRACKER__TRACKER__MODEL__BICYCLE_TRACKER_HPP_
#define MULTI_OBJECT_TRACKER__TRACKER__MODEL__BICYCLE_TRACKER_HPP_

#include "multi_object_tracker/tracker/model/tracker_base.hpp"
#include "multi_object_tracker/tracker/motion_model/bicycle_motion_model.hpp"

#include "multi_object_tracker/kalman_filter/kalman_filter.hpp"
namespace perception
{
    namespace algorithm
    {
        class BicycleTracker : public Tracker
        {
        private:
            LidarObject object_;

        private:
            struct EkfParams
            {
                double r_cov_x;
                double r_cov_y;
                double r_cov_yaw;
            } ekf_params_;

            double z_;

            struct BoundingBox
            {
                double length;
                double width;
                double height;
            };
            BoundingBox bounding_box_;

        private:
            BicycleMotionModel motion_model_;
            const char DIM = motion_model_.DIM;
            using IDX = BicycleMotionModel::IDX;

        public:
            BicycleTracker(
                const double &time, const LidarObject &object);

            bool predict(const double &time) override;
            bool measure(
                const LidarObject &object, const double &time) override;
            LidarObject getUpdatingObject(
                const LidarObject &object);
            bool measureWithPose(const LidarObject &object);
            bool measureWithShape(const LidarObject &object);
            bool getTrackedObject(
                const double &time,
                LidarObject &object) const override;
            virtual ~BicycleTracker() {}
        };
    }
}
#endif // MULTI_OBJECT_TRACKER__TRACKER__MODEL__BICYCLE_TRACKER_HPP_
